<?php
namespace app\home\model;
use think\Model;
use think\Db;
use think\Session;
class MyorderModel extends model{
    //获取所有订单数据
    public function getOrderGoods($status){
        $status['user_id'] = Session::get("USER.id");
        $status['o.is_del'] = 0;
        $order =  Db::table('order_goods')->alias('or')
            ->join('orders o','o.id = or.order_id')
            ->join('goods g','g.id = or.goods_id')
           ->join('goods_info gi','gi.goods_id= or.goods_id')
            ->field('or.goods_id,goods_name,g.goods_url,gi.goods_describe,o.id,order_status,goods_price,pay_status,order_num,order_amount,
            goods_num,goods_amount,add_time,o.is_appraises')
            ->where($status)
            ->select();
       return $order;
    }
    /*
     * 删除订单
    */
    public function deleteOrder($data){
        return $delOrder = Db::table('orders')->
        where("id=$data")->
        update(['is_del'=>'1']);
}
     /*
      * 物流查看*/
     public function logistics($data){
       return $res = Db::table('goods')->where($data)->find();
     }
}